package DBUtility;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ResourceBundle;

public class DBUtility {
    /**
     * Create parameter logger.
     */
    /**
     * Connection to database.
     * @return con
     * @throws SQLException
     * @throws ClassNotFoundException
     */
    public static Connection makeConnection() throws SQLException, ClassNotFoundException {
        try {
         // Using file DB.properties in src.
            ResourceBundle rb = ResourceBundle.getBundle("DB"); 
            Class.forName(rb.getString("driver"));
            String url = rb.getString("url");
            // Make connection from driver.
            Connection con = DriverManager.getConnection(url, rb.getString("username"), rb.getString("password"));
            return con;
        } catch (ClassNotFoundException ex) {
        } catch (SQLException ex) {
        }
        return null;
    }
}
